Rails.application.routes.draw do


  resources :fellows
  resources :collections
  resources :parises
  # get 'application/login'
  # root 'application#home'
  #
  concern :switch do
    member { put :switch }
  end


  namespace :backend do
    get '/login' => 'sessions#new', as: :login
    # get 'roles/index'
    # get 'permissions/index'
    match '/logout', to: 'sessions#destroy', as: :logout, via: :delete
    # resource :main, only: [:show]
    root 'mains#show'
    resource :session, only: [:new, :create, :destroy]
    resource :password, only: [:edit, :update]
    resources :admin_users, concerns: [:switch]
    resources :users, concerns: [:switch]
    resources :micoposts, concerns: [:switch]
    resources :roles
    resources :rules
    resources :permission_urls
    resources :menus
    resources :permissions
  end


  namespace :frontend do
    root 'micoposts#index'
    get '/login' => 'sessions#new', as: :login
    match '/logout', to: 'sessions#destroy', as: :logout, via: :delete
    resource :session, only: [:new, :create, :destroy]
    resource :parise, only: [:create, :destroy]
    resources :users, only: [:show, :new, :create, :update, :edit, :show]
    resources :micoposts
  end


end
